﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace ElingOA6_Admin_DSJCJ.DAL
{
    /// <summary>
    /// 数据访问类:ItemRequisitionApplyEntry
    /// </summary>
    public partial class ItemRequisitionApplyEntry
    {
        public ItemRequisitionApplyEntry()
        { }
        #region  BasicMethod
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select FItemRequisitionApplyEntryID,FItemRequisitionApplyID,FApplyQty,FQty,FPrice,FAmount,FItemNo,FEntityNo ");
            strSql.Append(" FROM dbo.t_ItemRequisitionApplyEntry ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ElingOA6_Admin_DSJCJ.Model.ItemRequisitionApplyEntry DataRowToModel(DataRow row)
        {
            ElingOA6_Admin_DSJCJ.Model.ItemRequisitionApplyEntry model = new ElingOA6_Admin_DSJCJ.Model.ItemRequisitionApplyEntry();
            if (row != null)
            {
                if (row["FItemRequisitionApplyEntryID"] != null && row["FItemRequisitionApplyEntryID"].ToString() != "")
                {
                    model.FItemRequisitionApplyEntryID = int.Parse(row["FItemRequisitionApplyEntryID"].ToString());
                }
                if (row["FItemRequisitionApplyID"] != null && row["FItemRequisitionApplyID"].ToString() != "")
                {
                    model.FItemRequisitionApplyID = int.Parse(row["FItemRequisitionApplyID"].ToString());
                }
                if (row["FApplyQty"] != null)
                {
                    model.FApplyQty = row["FApplyQty"].ToString();
                }
                if (row["FQty"] != null && row["FQty"].ToString() != "")
                {
                    model.FQty = decimal.Parse(row["FQty"].ToString());
                }
                if (row["FPrice"] != null && row["FPrice"].ToString() != "")
                {
                    model.FPrice = decimal.Parse(row["FPrice"].ToString());
                }
                if (row["FAmount"] != null && row["FAmount"].ToString() != "")
                {
                    model.FAmount = decimal.Parse(row["FAmount"].ToString());
                }
                if (row["FItemNo"] != null)
                {
                    model.FItemNo = row["FItemNo"].ToString();
                }
                if (row["FEntityNo"] != null)
                {
                    model.FEntityNo = row["FEntityNo"].ToString();
                }
            }
            return model;
        }


        #endregion  BasicMethod

        /// <summary>
        /// 获取明细数据
        /// </summary>
        /// <creator>chenly</creator>
        /// <date>2013-9-29</date>
        /// <param name="paperID">订单编号</param>
        /// <returns>数据列表</returns>
        public DataSet GetListEntry(decimal itemRequisitionApplyID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  FItemRequisitionApplyEntryID,FItemRequisitionApplyID,FApplyQty,FQty,FPrice,FAmount,FItemNo,FEntityNo");
            strSql.Append(" FROM dbo.t_ItemRequisitionApplyEntry ");
            strSql.Append(" where FItemRequisitionApplyID=@FItemRequisitionApplyID");
            SqlParameter[] parameters = {
					new SqlParameter("@FItemRequisitionApplyID",SqlDbType.Int,4)};
            parameters[0].Value = itemRequisitionApplyID;

            return DbHelperSQL.Query(strSql.ToString(), parameters);
        }

        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

